<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java"
	import="java.util.*,cn.jbit.mybatisdemo.entity.*" pageEncoding="UTF-8"%>
<%@ include file="common/taglib.jsp"%>
<%@ include file="common/common.jsp"%>
<html>
<head>
<link href="<%=request.getContextPath()%>/css/common.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="<%=request.getContextPath()%>/ckeditor/ckeditor.js"></script>
</head>
<%
	String empNo = request.getParameter("empNo");
	if (empNo != null && !empNo.equals("")) {
		Emp emp = empService.findEmpByEmpNo(Integer.parseInt(empNo));
		request.setAttribute("emp", emp);
	}
	List list = deptService.findAll();
	request.setAttribute("list", list);
%>
<body>
	<script type="text/javascript"
		src="<%=request.getContextPath()%>/js/My97DatePicker/WdatePicker.js"></script>
	<form name="dataForm" id="dataForm"
		action="<%=request.getContextPath()%>/EmpServlet" method="post">
		<table class="tb" border="0" cellspacing="5" cellpadding="0">
			<thead>
				<tr>
					<td align="center" colspan="2" class="text_tabledetail2">增加员工</td>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td class="text_tabledetail2">部门</td>
					<td>
						<!-- 列出所有的新闻分类 --> <select name="deptno">
							<c:forEach var="dept" items="${list}">
								<option value='${dept.deptno}'
									<c:if test="${dept.deptno==param.deptno ||dept.deptno==emp.deptno}">selected</c:if>>${dept.dname}</option>
							</c:forEach>
					</select>
					</td>
				</tr>
				<tr>
					<td class="text_tabledetail2">姓名</td>
					<td><input type="text" name="empName" value="${emp.empName}" /></td>
				</tr>
				<tr>
					<td class="text_tabledetail2">职位</td>
					<td><input type="text" name="job" value="${emp.job}" /></td>
				</tr>
				<%-- 	<tr>
				<td class="text_tabledetail2">上级经理编号</td>
				<td><input type="text" name="mgr" value="${emp.mgr}"/></td>
			</tr> --%>

				<tr>
					<td class="text_tabledetail2">入职时间</td>
					<td><input type="text" name="hireDate"
						onFocus="WdatePicker({startDate: '1980-05-01' ,alwaysUseStartDate: true })"
						value='<fmt:formatDate value="${emp.hireDate}" pattern="yyyy-MM-dd"/>' /></td>
				</tr>
				<tr>
					<td class="text_tabledetail2">工资</td>
					<td><input type="text" name="salary" value="${emp.sal}" /></td>
				</tr>
				<%-- <tr>
				<td class="text_tabledetail2">奖金</td>
				<td><input type="text" name="comm" value="${emp.comm}"/></td>
			</tr> --%>

				<tr>
					<td style="text-align: center;" colspan="2">
						<button type="submit" class="page-btn" name="save">保存</button> <input
						type="hidden" name="empNo" value="${emp.empNo}" /> 
						<c:if
							test="${!empty emp }">
							<input type="hidden" name="opt" value="update" />
						</c:if>

						<button type="button" class="page-btn" name="return"
							onclick="javascript:location.href='empList.jsp'">返回</button>
					</td>
				</tr>
			</tbody>
		</table>
	</form>
</body>

</html>